module SemanticText
  class BulletedList
  	attr_reader :content
    attr_reader :depth

  	def initialize(depth)
  		@content = []
  		@depth = depth
  	end
	
  	def <<(bullet)
  	  if bullet.depth>@depth
        if @content.last.class != BulletedList
    	    @content << BulletedList.new(depth+1)
        end
  	    @content.last << bullet
      else
  	    @content << bullet
  	  end 
    end
  
    def size
      @content.size
    end
    
    #export as html
    def export_html
      tabs = "\t"*depth
      out = "\n#{tabs}<ul>"
      content.each {|element| out=out+element.export_html}
      out = out + "\n#{tabs}</ul>"
    end
    
  end
    
end